/**	
 * Author : Mht
 * Desc : For 2016 RDM 
 */
package bean;

import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import lombok.extern.log4j.Log4j;

/**
 * @author Mht
 * @date Jun 7, 2016
 */
@Log4j
//@RestController
public class ErrorHandlerController implements ErrorController {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.springframework.boot.autoconfigure.web.ErrorController#getErrorPath()
	 */
	@Override
	public String getErrorPath() {
		// TODO Auto-generated method stub
		return "/error";
	}

	@RequestMapping(value = "/error")
	public String handle404Error() {
		log.info("jsp/404 Coming in......error");
		return "redirect:jsp/error";
	}

	private String makeErrorHtml() {
		return "<html><body><h1>Whitelabel Error Page</h1>"
				+ "<p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>"
				+ "<div id='created'>${timestamp}</div>"
				+ "<div>There was an unexpected error (type=${error}, status=${status}).</div>"
				+ "<div>${message}</div></body></html>";
	}
}
